import time as time
class Hero:
    def __init__(self,name,blood,attack,defense):
        self.blood =blood
        self.attack=attack
        self.defense=defense
        self.name=name

        print(name,"英雄已初始化!")
       #定义攻击函数
    def do_attack(self,other):
            print(self.name,"正在攻击",other.name)
            other.blood = other.blood+other.defense - self.attack
           # if other.blood <= 0:
            print(other.name,"血量",other.blood)
            return other.blood
if __name__ == '__main__':
           a = Hero("碎星将军拉塔恩",100,7,5)
           b = Hero("满月女王蕾娜",90,10,2)
           while 1:
                time.sleep(1)
                print("___________________")
                b_blood=a.do_attack(b)
                if b_blood<=0:
                        print(b.name,"死亡")
                        break
                time.sleep(1)
                print("_______________")
                a_blood=b.do_attack(a)
                if a_blood<=0:
                    print(a.name,"死亡")
                    break